home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 248
/
248.d81
/
t.db+ doc 5
< prev
next >
Wrap
Text File
|
2022-08-26
|
11KB
|
443 lines
u
DOTBASIC PLUS
Part V
by Dave Moorman & Lee Novak
EXTENDING DB+
-------------
We have added four major ML
Modules to DB+ which use memory from
page 128 through 207. You don't have
to worry much about memory management,
because the area is safely placed
above the Top of Basic. However, you
may want to know how things are laid
out.
Page Contents
---- ------------
128 !BMP Color !
129 ! !
130 ! !
131 !..........!
132 !Sprites !
133 !..........!
134 !Grafstar !
135 ! !
136 ! !
% %,',',',','%
143 ! !
144 ! !
145 !..........!
146 !MUS File !
% %,',',',','%
151 ! !
152 !..........!
153 !Scriptor !
154 ! !
155 !..........!
156 !BMP Multi-!
157 !Color Data!
158 ! !
159 !..........!
160 !BitMapData!
% %,',',',','%
191 !..........!
192 !SIDPlayer !
% %,',',',','%
204 !..........!
205 !BitMap !
206 !Load/Unpak!
207 !..........!
If you are not using .BMP,
.GRAF, or .SCRIPT, then everything
from 144-159 is available for Music
files, and pages 160-191 are available
for data, such as directories and
text. Now you know more than you
really needed.
BITMAP
------
Include .BMP
.BMP,FILE$,DV,160,128,156
.BMPSCR,SWITCH
SWITCH 1 = Display Bitmap
0 = Display Text Screen
When you include .BMP in your
program, .BMP and .BMPSCR are added to
your Command list. Also, an auxillary
file bload is added to your boot
program so that DBA.UNP.ML is copied
to your work disk and loaded into
memory -- using pages 205-207. Also,
the Top of BASIC is lowered from page
160 to 128, to make room for the
bitmap, which uses 128-132, 160-191,
and 156-159 for display.
In your program, use .BMP to load
and unpack a LOADSTAR SHP graphic
file, using the values listed above.
The arrow sprite is automatically
copied to page 132 and switched over
by .BMP.
100 .BMP,"GRAPHIC.SHP",D,160,128,156
110 .BMPSCR,1
120 .DO:.MA:.UN L2%
130 .BMPSCR,0
Your mouse arrow will not even
flicker! Oh, you don't want the arrow
on the graphic? Add POKE 53269,0 to
line 110 and POKE 53269,3 to line 130.
SIDPLAYER
---------
Include: .SID
.SID,LOCATION
.SIDOFF
DB+ will play SIDSongs! When you
include .SID in your program, .SID and
.SIDOFF are added to your Command
List. Also, an auxillary file bload is
added to your boot program so that
DBA.SID.ML is loaded into memory --
using pages 192-204. Also, the Top of
BASIC is lowered from page 160 to 144
(unless .BMP is used), to make room
for the MUS file(s) at 144-154 (with
.BMP) or 144-159 (without .BMP).
100 .BL,"MUSIC1.MUS",D,144*256
110 .SID,144*256
120 .DO:.MA:.UN L2%
130 .SIDOFF
GRAFSTAR
--------
Include: .GRAF
.GRAF
.GMODE,MODE#
.GPEN,P0,P1,P2,P3
.GPLOT,X,Y,PEN
.GLINE,X,Y,PEN
.GP,X,Y
.GCLIP,X1,X2,Y1,Y2
.GOFFSET,XOFF,YOFF
.GYREV,DIR
.GFILL,X,Y,PEN
The world of bitmap graphics from
DotBASIC Plus is made possible by a
module Dave Moorman wrote years ago --
Grafstar. As you can gather from the
commands listed above, we have a lot
of power here! When you include .GRAF
in your program, all the other
commands listed above are added to
your Command List. Also, an auxillary
file bload is added to your boot
program so that DBA.GRA.ML is loaded
into memory -- using pages 134-145.
You can use the Grafstar commands
along with .BMP commands.
.GRAF -- This MUST be the first
command of the Grafstar commands
used. This initializes the location
for the Bitmap -- Bitmap at page 160,
color at page 128, just like with the
.BMP command.
.GMODE,MODE# -- Sets the type of
screen that is being displayed.
0 Default Text Screen
1 High Res Bitmap
2 Text Screen -- Multi-Color
3 Multi-Color Bitmap
* 4 Show Text, Clear High Res
* 5 High Res Bitmap, Cleared
* 6 Show Text, Clear Multi-C
* 7 Multi-Color Bitmap, Cleared
* Modes 4 - 7 put 0's in all
bitmap locations. Modes 4 and 5 also
put current colors for pens 0 and 1
into the color map.
If you are using .GRAF commands
with .BMP, use .BMP,f$,d,160,128,156
to load the SHP graphic, then --
rather than .BMPSCR -- use .GMODE,1
(hi res) or .GMODE,3 (multi-color) to
switch to the bitmap, and .GMODE,0 to
return to the text screen. (.BMPSCR
has a toggling effect that gets
cumbersome.)
.GPEN,P0,P1,P2,P3 -- This sets the
colors of the four "pens" used with
.GPLOT .GLINE and .GFILL. The four
background color registers are used
for this, so P0 will change the
background of your text screen (use
.BG,color to reset the background of
the text screen after .GMODE,0).
.GPLOT,X,Y,PEN -- Plots a pixel at
pixel X/Y in the color set for the PEN
number. X/Y values off the screen are
OK, just not visible.
.GLINE,X,Y,PEN -- Draws a line
from the previous .GPLOT or the last
point of the previous .GLINE.
.GP,X,Y -- Returns the pen number
of the pixel at X/Y in P%. If X/Y is
not visible, P% will hold 128.
.GCLIP,X1,X2,Y1,Y2 -- GrafStar
uses dynamic clipping to avoid trying
to plot a point that is out of bounds.
Before calculating the actual memory
and bit location, the coordinates are
checked against the clip parameters.
If not visible, GrafStar avoids some
useless drudgery! But the upshot is
that you can set the clip parameters
with this command. With .GCLIP, you
can keep your graphics within a window
area.
Note that you must add 1 to the
RIGHT and BOTTOM values. Or to put it
another way, LEFT and TOP is the first
point to be plotted while RIGHT and
BOTTOM is the first point to be
clipped. Clip values MUST be within
the following range:
LEFT -- 0 - 319 (High Res)
LEFT -- 0 - 159 (Multi-Color)
RIGHT -- 1 - 320 (High Res)
RIGHT -- 1 - 160 (Multi-Color)
TOP -- 0 - 199
BOTTOM -- 1 - 200
Also, RIGHT must be greater than
LEFT and BOTTOM greater than TOP.
GrafStar checks and produces an
ILLEGAL VALUE ERROR when something is
wrong.
.GOFFSET,XOFF,YOFF -- Lets you
place the coordinates 0,0 ANYWHERE on
the screen. Negative coordinates are
visible.
XOFF -- number of pixels that the
X coordinate 0 will be pushed to the
right.
YOFF -- number of pixels that the
Y coordinate 0 will be pushed down.
XOFF and YOFF must be legal screen
coordinates:
XOFF -- 0 - 319 (High Res)
XOFF -- 0 - 159 (Multi-Color)
YOFF -- 0 - 199
With OFFSET, you can define
polygons as a series of vertices, in
all four quadrants, and position the
polygon with the OFFSET command. To
center the plotting of a polynomial,
set the OFFSET to the middle of the
screen:
.GOFFSET, 160, 100
Just think of the possibilities!
.GYREV,DIR -- DIR indicates which
way a plot moves when the Y coordinate
is increased:
DIR
0 Normal -- moving down screen
1 Reverse -- moving up screen
My son, the mathematician,
complained that the C-64 designers got
it all wrong. Positive Y coordinates
should move UP along the X axis, not
down! Or to put it another way: Don't
you just hate having to do a 199-Y to
get the graph to appear right side up?
.GYREV does it all for you. For
instance, to create a true
mathematical plot with 0,0 at the
center of the screen:
.GOFFSET, 160, 100 :rem Offset
.GYREV, 1 :rem Y is UP!
.GFILL,X,Y,PEN -- Someday, I will
learn NOT to call Fender before a
project is finished <grin>. He always
has one more idea to include in a
program! In this case, it was a fill
command. The parameters are identical
to PLOT, LINE, and POINT, and are
adjusted in the same way for OFFSET an
Y-REVERSE. FILL will take the pen
value at the coordinates given,
consider it "empty," and replace every
contigenous instance with the PEN#
given in the command, stopping at the
occurance of any location that is "not
empty."
You will note that GrafStar's
FILL is reasonably fast. This is
because if an entire byte of bitmap
memory is "empty," the byte is filled
at on